class Solution {
public:
    double average(vector<int>& salary) {
        int max=0,min=salary[1],total=0;
        for(auto i :salary){
            if(i>max)max=i;
            if(i<min)min=i;
            total+=i;
        }
        return (total-min-max)*1.0/(salary.size()-2);
    }
};
